﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>


<%
NEXMI.NMProductsBL BL = new NEXMI.NMProductsBL();
NEXMI.NMProductsWSI WSI = new NEXMI.NMProductsWSI();
WSI.Mode = "SRC_OBJ";
WSI.Product = new NEXMI.Products();
//WSI.Product.Highlight = true;
List<NEXMI.NMProductsWSI> WSIs = BL.callListBL(WSI);
List<NEXMI.NMProductsWSI> Item;

NEXMI.NMCategoriesBL cBL = new NEXMI.NMCategoriesBL();
NEXMI.NMCategoriesWSI cWsi = new NEXMI.NMCategoriesWSI();
cWsi.Mode = "SRC_OBJ";
List<NEXMI.NMCategoriesWSI> cWsis = cBL.callListBL(cWsi);

foreach (NEXMI.NMCategoriesWSI c in cWsis)
{
%>
<div class="art-block clearfix">
    <div class="art-blockheader">
        <h3 class="t"><%=c.Translation.Name %></h3>
    </div>
    <div class="art-blockcontent">
<%
    Item = WSIs.Where(s => s.Product.CategoryId == c.Category.Id).ToList();
    if (Item.Count > 0)
    {
        //foreach (NEXMI.NMProductsWSI Item in WSIs.Where(s => s.Product.CategoryId == c.Category.Id).Select(i => i))
        for (int i = 0; i < Item.Count; i++)
        {
%>
        <div class="art-layout-cell layout-item-2" style="width: 25%" >
            <h4><%= Item[i].Translation.Name%></h4>
            <p><img width="168" height="153" alt="" src="<%=Url.Content("~")%>quantri/uploads/_thumbs/<%= (Item[i].Images.Count != 0)? Item[i].Images[0].Name : "" %>" /></p>
            <p><%= Item[i].Translation.ShortDescription%>.</p>
            <p><a href="#" class="art-button">Xem thêm</a></p>
        </div>
<%
            if (i >= 3)
                break;
        }
    }
%>
    </div>
</div>
<%} %>